import { defineStore } from 'pinia';
import type { UserDTO } from '../type/User';

export const useUserStore = defineStore('user', {
  state: () => ({
    userInfo: {} as UserDTO, // 当前用户信息
    invitationToken: null as string | null, // 存储邀请 Token
  }),

  actions: {
    
    setUserInfo(newUserInfo: UserDTO) {
      this.userInfo = newUserInfo;
    },

    removeUserInfo() {
      this.userInfo = {};
    },
    // 设置邀请 Token
    setInvitationToken(token: string | null) {
      this.invitationToken = token;
    }
  },
  persist:true

  
});